/**
 * Created by liuzhentao on 2016/7/7.
 */


var mongoose = require('mongoose');

var blogSchema = new mongoose.Schema({
    title:  String,
    author: String,
    body:   String,
    comments: [{ body: String, date: Date }],
    date: { type: Date, default: Date.now },
    hidden: Boolean,
    meta: {
        votes: Number,
        favs:  Number
    }
});

blogSchema.methods.displayBody = function () {
    return '内容:'+(this.body);
};

var Blog = mongoose.model('Blog',blogSchema);

module.exports = Blog;
